.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;

  > input {
    opacity: 0;
    width: 0;
    height: 0;

    // disabled
    &:disabled {
      + .switch--thumb {
        cursor: not-allowed;
        background-color: hsla(var(--disabled-bg));
        &:before {
          background-color: hsla(var(--disabled-fg));
        }
      }
      // disabled and checked
      &:checked + .switch--thumb {
        cursor: not-allowed;
        background-color: hsla(var(--primary-bg));
        &:before {
          background-color: hsla(var(--disabled-fg));
        }
      }
    }

    &:checked + .switch--thumb {
      background-color: hsla(var(--primary-bg));

      &::before {
        -webkit-transform: translateX(14px);
        -ms-transform: translateX(14px);
        transform: translateX(14px);
      }
    }
  }

  &--thumb {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsla(var(--switch-bg));
    -webkit-transition: 0.4s;
    transition: 0.4s;
    border-radius: 20px;

    &:before {
      position: absolute;
      content: '';
      height: 14px;
      width: 14px;
      left: 2px;
      bottom: 2px;
      background-color: hsla(var(--switch-fg));
      -webkit-transition: 0.4s;
      transition: 0.4s;
      border-radius: 50%;
    }
  }
}
